﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace Planetwork
{
    public partial class ViewPics : System.Web.UI.Page
    {
        static string conStr = ConfigurationManager.AppSettings["conStr"];
        SqlConnection mycon = new SqlConnection(conStr);
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["index"] == null || Request.QueryString["index"] == "")
            {
                // Response.Write("<script>alert('Code还未完善,请从Default下方主入口进入');window.location.href = 'Default.aspx';</script>");
                Response.Redirect("../GigPics/ViewPics.aspx?index=12");
            }
                      
            BindData();
        }

        /// <summary>
        /// 数据源
        /// </summary>
        void BindData()
        {
            
            try
            {
                string sql = "select *from Images where ParentID=" + Request.QueryString["index"].ToString();
                SqlDataAdapter mydat = new SqlDataAdapter(sql, mycon);
                DataSet myds = new DataSet();
                mycon.Open();
                mydat.Fill(myds);
                mycon.Close();

                if (myds.Tables[0].Rows.Count > 0)
                {
                    this.showImageList.DataSource = myds.Tables[0];
                    this.showImageList.DataBind();
                }
            }
            catch
            {

            }
        }
    }
}